Documentation for class program

Inherits from 	complex_object 

Properties declared in program 
	databases 
	icon 
	images 
	key_window 
	main_menu 
	main_window 
	reply_timeout 
	send_timeout 
	sounds 
	timers 
	version 
	windows 

Class Methods declared in program 
	new 

Methods declared in program 
	action 
		close_the_console 
		hide 
		open_the_color_panel 
		open_the_console 
		open_the_font_panel 
		quit 
		stop 
		unhide 
	any 
		alert(title, message, default_button_title, alternate_button_title, other_button_title) 
		application_for(file) 
		archive(file, object) 
		ask(title) 
		ask_open_file(title, prompt, file_type) 
		ask_open_files(title, prompt, file_type) 
		ask_save_file(title, prompt, file_type) 
		broadcast(message, arguments, wait_for_reply) 
		close_the_console 
		confirm(title, message) 
		craftman_did_become_active 
		craftman_did_hide 
		craftman_did_resign_active 
		craftman_did_unhide 
		databases 
		date 
		date_and_time 
		day_of_month 
		day_of_week 
		day_of_year 
		dont_send_this_message 
		dont_send_this_message_either 
		eval_in_unix(string) 
		fileinfo_for(file) 
		filename 
		files_in(path, type, include_dot) 
		filetype_for(file) 
		folders_in(path, type, include_dot) 
		folder_paths_in(path, type, include_dot) 
		hide 
		hour(24_hour) 
		icon 
		images 
		is_program_launched(host, name) 
		key_window 
		launch_application(host, application) 
		main_menu 
		main_window 
		minute 
		month 
		month_name(abbreviated) 
		notify(title, message) 
		open_file(host, path) 
		open_the_color_panel 
		open_the_console 
		open_the_font_panel 
		path 
		paths_in(path, type, include_dot) 
		plain_files_in(path, type, include_dot) 
		plain_paths_in(path, type, include_dot) 
		program_did_become_active 
		program_did_enter_runmode 
		program_did_hide 
		program_did_resign_active 
		program_did_unhide 
		program_was_unarchived 
		query(title, default_string, default_button_title, alternate_button_title) 
		quit 
		random_number(min, max) 
		random_percent 
		reply_timeout 
		second 
		send_alien_message(host, application, selector, types, args) 
		send_remote_message(host, program, wait_for_reply, message, arguments) 
		send_timeout 
		send_to_unix(string) 
		set_icon(image) 
		set_main_menu(menu) 
		set_reply_timeout(number) 
		set_send_timeout(number) 
		set_version(number) 
		sleep(milliseconds) 
		sounds 
		stop 
		time 
		timers 
		time_zone 
		unarchive(file) 
		unhide 
		verify(title, message) 
		version 
		weekday(abbreviated) 
		week_of_year 
		windows 
		year 
	events 
		craftman_did_become_active 
		craftman_did_hide 
		craftman_did_resign_active 
		craftman_did_unhide 
		program_did_become_active 
		program_did_enter_runmode 
		program_did_hide 
		program_did_resign_active 
		program_did_unhide 
		program_was_unarchived 
	file 
		application_for(file) 
		fileinfo_for(file) 
		files_in(path, type, include_dot) 
		filetype_for(file) 
		folders_in(path, type, include_dot) 
		folder_paths_in(path, type, include_dot) 
		paths_in(path, type, include_dot) 
		plain_files_in(path, type, include_dot) 
		plain_paths_in(path, type, include_dot) 
	get 
		databases 
		icon 
		images 
		key_window 
		main_menu 
		main_window 
		reply_timeout 
		send_timeout 
		sounds 
		timers 
		version 
		windows 
	set 
		set_icon(image) 
		set_main_menu(menu) 
		set_reply_timeout(number) 
		set_send_timeout(number) 
		set_version(number) 
	speak 
		broadcast(message, arguments, wait_for_reply) 
		eval_in_unix(string) 
		is_program_launched(host, name) 
		launch_application(host, application) 
		open_file(host, path) 
		paths_in(path, type, include_dot) 
		send_alien_message(host, application, selector, types, args) 
		send_remote_message(host, program, wait_for_reply, message, arguments) 
		send_to_unix(string) 
	speak_alien 
		paths_in(path, type, include_dot) 
	time 
		date 
		date_and_time 
		day_of_month 
		day_of_week 
		day_of_year 
		hour(24_hour) 
		minute 
		month 
		month_name(abbreviated) 
		second 
		time 
		time_zone 
		weekday(abbreviated) 
		week_of_year 
		year 

Class 
#begin_class
program 
The class program is a sub-class of the class complex_object. 
Every CraftMan program is an object of the class program.

The program is a very powerful object that knows about:
- the UNIX file-system
- communicating with other CraftMan programs
- communicating with other NeXTstep applications
- time
- random number generation
- dialog boxes

You reference the program by the constant the_program.

Ex:
To get the current date you type 
the_program:date
which returns something like "Thu Feb 27 1992"

The program stores references to all objects of the following classes:
- database 
- image
- sound
- timer 
- window 

Ex:
To get a collection of all the images in the program you type
the_program:images
which returns something like [{image my_image1} {image my_image2}]
#end_class

Properties 

#begin_property
databases 
Stores a collection of all the database objects in the program.
#end_property

#begin_property
icon 
Stores a reference to the image that is used as the icon of the program. The default icon is the built-in image {image program}.
#end_property

#begin_property
images 
Stores a collection of all the image objects in the program.
Note: The built-in images (like {image next})will not appear in this list. They are shared by all CraftMan programs.
#end_property

#begin_property
key_window 
Stores a reference to the window that is the key window, i.e. has a black title-bar and accepts keyboard input.
#end_property

#begin_property
main_menu 
Stores a reference to the main menu of the program, i.e. the menu in the upper left corner of the screen if the program runs under CraftManEngine, or the menu under the menu Current if if the program runs under CraftMan.
#end_property

#begin_property
main_window 
Stores a reference to the window that is the main window.
#end_property

#begin_property
reply_timeout 
The number of milliseconds the program will wait for a reply when a message has been sent to another program. Default is 30000 (30 seconds).
#end_property

#begin_property
send_timeout 
The number of milliseconds the program will wait for an acknowledge when a message has been sent to another program. Default is 30000 (30 seconds).
#end_property

#begin_property
sounds 
Stores a collection of all the sound objects in the program.
Note: The built-in sounds (like {sound bonk}) will not appear in this list. They are shared by all CraftMan programs.
#end_property

#begin_property
timers 
Stores a collection of all the timer objects in the program.
#end_property

#begin_property
version 
Stores the version number of the program. By default version is 0.
#end_property

#begin_property
windows 
Stores a collection of all the window objects in the program.
#end_property

Methods 

#begin_method
alert(title, message, default_button_title, alternate_button_title, other_button_title) 
Opens a dialog box with a title, a message and three buttons. The return value depends on the button the user clicks.
title is the title of the dialog box.
message is the message of the dialog box.
default_button_title is the title of the default button.
alternate_button_title is the title of the alternate button.
other_button_title is the title of the other button.
If the default button is clicked the method returns true.
If the alternate button is clicked the method returns false.
If the other button is clicked the method returns nil.
Ex:
x := the_program:alert("Warning", "Do you really want to do this?", "Do it!", "Cancel", "Help") 
if x = true then
	print("I did it!")
end if
if x = false then
	print("I won't do it!")
end if
if x = nil then
	print("There is no help to get...")
end if
#end_method

#begin_method
application_for(file)
Returns the application for file. If file is not a valid filename the method will return false. 
Ex:
the_program:application_for(".login")
returns "Workspace"
#end_method

#begin_method
archive(file, object) 
Writes object to the file with the filename file. If file is not a complete filename the file will be placed in the home directory. If file is not a valid filename or if you do not have write permission the method returns false.
Returns self.
Also see unarchive(file).
#end_method

#begin_method
ask(title) 
Opens a dialog box with a title, a textfield and two buttons. The return value depends on the button the user clicks. 
If the user clicks the "Ok"-button the method returns the string in the textfield.
If the user clicks the "Cancel"-button the method returns false.
title is the title of the dialog box.
Ex:
x := the_program:ask("What is your name?")
if x <> false then
	s := "Hello "
	s := s + x + "!"
	print(s)
end if
#end_method

#begin_method
ask_open_file(title, prompt, file_type) 
Opens an open panel. 
If the user selects a file in the panel and clicks the "Ok"-button the filename will be returned.
If the user clicks the "Cancel"-button the method returns false.
title is the title of the open panel.
prompt is the prompt of the open panel.
file_type is the extension if the files that should be visible in the open panel. If all files should be visible, prompt should be set to nil.
Ex:
the_program:ask_open_file("Open file", "", "wn")
will open a panel with all WriteNow files visible.
the_program:ask_open_file("Open file", "", nil)
will open a panel with all files visible.
Also see ask_open_files(title, prompt, file_type).
#end_method

#begin_method
ask_open_files(title, prompt, file_type) 
Opens an open panel. 
If the user selects one or more files in the panel and clicks the "Ok"-button a collection of the filenames will be returned.
If the user clicks the "Cancel"-button the method returns false.
title is the title of the open panel.
prompt is the prompt of the open panel.
file_type is the extension if the files that should be visible in the open panel. If all files should be visible, prompt should be set to nil.
Ex:
the_program:ask_open_file("Open file", "", "wn")
will open a panel with all WriteNow files visible.
the_program:ask_open_file("Open file", "", nil)
will open a panel with all files visible.
Also see ask_open_file(title, prompt, file_type).
#end_method

#begin_method
ask_save_file(title, prompt, file_type) 
Opens an save panel. 
If the user defines a filename in the panel and clicks the "Ok"-button the complete will be returned.
If the user clicks the "Cancel"-button the method returns false.
title is the title of the save panel.
prompt is the prompt of the save panel.
file_type is the extension if the files that should be visible in the save panel. If all files should be visible, prompt should be set to nil.
Ex:
the_program:ask_save_file("Open file", "", "wn")
will open a panel with all WriteNow files visible.
the_program:ask_save_file("Open file", "", nil)
will open a panel with all files visible.
#end_method

#begin_method
broadcast(message, arguments, wait_for_reply) 
Sends the CraftScript message to all CraftMan programs that are open on the local machine. The sending program does not receive the message.
If the message has arguments they should be passed as the collection arguments.
If the message has no arguments the value of arguments should be nil.
If you want the return values from the messages wait_for_reply should be true.
The method returns a collection of values, one for each program that received the message.
If wait_for_reply is false you will get one of the following values:
true - the execution of the method was successful.
false - the execution of the method failed.
#program_is_in_edit_mode - the program was in edit-mode.
#program_is_running - the program was running.
#message_not_understood - the program did not understand the message.
#wrong_number_of_arguments - the message was sent with the wrong number of arguments.
If wait_for_reply is true you will get the return value from the method or one the following values:
false - the execution of the method failed.
nil - the return value was of a class that does not exist in the current program.
#program_is_in_edit_mode - the program was in edit-mode.
#program_is_running - the program was running.
#message_not_understood - the program did not understand the message.
#wrong_number_of_arguments - the message was sent with the wrong number of arguments.
Ex:
Assume that you have three programs open. The first of them is in edit-mode. From the second program the message my_add(x, y) is broadcasted. The method my_add(x, y) is implemented in all the three programs and it adds two numbers and returns the sum.
the_program:broadcast("my_add", [12 13], true)
will return [#program_is_in_edit_mode 25]
the_program:broadcast("my_add", [12 13], false)
will return [#program_is_in_edit_mode true]
#end_method

#begin_method
close_the_console 
Closes the Console window.
Returns self.
#end_method

#begin_method
confirm(title, message) 
Opens a dialog box with a title, a message and two buttons. The return value depends on the button the user clicks. 
If the user clicks the "Ok"-button the method returns true.
If the user clicks the "Cancel"-button the method returns false.
title is the title of the dialog box.
message is the message of the dialog box.
Ex:
x := the_program:confirm("Warning!", "Really wanna hear a beep?")
if x = true then
	{sound}:beep
end if
#end_method

#begin_method
craftman_did_become_active 
This method does not do anything. The message is sent to the program when CraftMan becomes the active application. Specialize the method to get the desired behavior. 
Returns self.
#end_method

#begin_method
craftman_did_hide 
This method does not do anything. The message is sent to the program when CraftMan is hidden in the Workspace. Specialize the method to get the desired behavior. 
Returns self.
#end_method

#begin_method
craftman_did_resign_active 
This method does not do anything. The message is sent to the program when CraftMan resigns from being the active application. Specialize the method to get the desired behavior. 
Returns self.
#end_method

#begin_method
craftman_did_unhide 
This method does not do anything. The message is sent to the program when CraftMan is unhided in the Workspace. Specialize the method to get the desired behavior. 
Returns self.
#end_method

#begin_method
databases 
Returns the databases property of the program.
#end_method

#begin_method
date 
Returns the current date.
Ex:
the_program:date
returns something like "Thu Feb 27 1992"
#end_method

#begin_method
date_and_time 
Returns the current date and time.
Ex:
the_program:date_and_time
returns something like "Thu Feb 27 14:44:34 GMT+0100 1992"
#end_method

#begin_method
day_of_month 
Returns the day of the current month.
Ex:
Assume the date is "Thu Feb 27 1992".
the_program:day_of_month
returns 27
#end_method

#begin_method
day_of_week 
Returns the day of the current week.
Ex:
Assume the date is "Thu Feb 27 1992".
the_program:day_of_week
returns 4
#end_method

#begin_method
day_of_year 
Returns the day of the current year.
Ex:
Assume the date is "Thu Feb 27 1992".
the_program:day_of_year
returns 57
#end_method

#begin_method
dont_send_this_message 
Do not send this message! It will make CraftMan crash. It only exists for internal reasons. 
#end_method

#begin_method
dont_send_this_message_either 
Do not send this message! It will make CraftMan crash. It only exists for internal reasons. 
#end_method

#begin_method
eval_in_unix(string) 
Evaluates string in a UNIX shell and returns the output (stdout) as a string.
Ex:
files := the_program:eval_in_unix("ls")
returns something like 
"Apps
Library
Mailboxes
WNDictionary.wndict
"
files:split(\nl)
will split the sting on the newline character into a collection of all the filenames in your home directory.
["Apps" "Library" "Mailboxes" "WNDictionary.wndict"]
Warning: Do not use the eval_in_unix message to start programs that takes over the terminal and waits for input (like bc). This will lead to an infinite loop.
#end_method

#begin_method
fileinfo_for(file) 
Returns the type of the file with the complete filename file. If file is not a valid filename the method returns false. The different filetypes are:
#is_file - the file is a file.
#is_directory - the file is a directory.
#is_application - the file is an application.
#is_optical_disk_mounted - the file is mounted on an optical drive.
#is_net_mounted - the file is mounted on the network.
#is_scsi_mounted - the file is mounted on a SCSI device.
Ex:
the_program:fileinfo_for("/")
returns #is_scsi_mounted
the_program:fileinfo_for("/NextApps")
returns #is_directory
#end_method

#begin_method
filename 
Returns the filename for the current program.
Also see path.
#end_method

#begin_method
files_in(path, type, include_dot) 
Returns a collection of the names of the files in the directory with the full pathname path. 
type specifies the file extension of the files you want to collect. If you want to collect all files type should be nil.
include_dot should be true if you want to include hidden files (i.e. files with a dot (.) in the beginning).
Ex:
the_program:files_in("/", nil, true)
returns something like ["." ".." "lost+found" "mach" ".hidden" ".login" ".cshrc" ".profile" ".NeXT" "etc" "dev" "tmp" "usr" "bin" "private" "NextApps" "lib" "NextDeveloper" "NextAdmin" "NextLibrary" "Net" "odmach" "sdmach" "me" "NextTour" "LocalApps" "Mailboxes" "LocalLibrary" ".createImages" ".wp.set" "Users" ".NextTrash" "clients"]
the_program:files_in("/", nil, false)
returns something like ["lost+found" "mach" "etc" "dev" "tmp" "usr" "bin" "private" "NextApps" "lib" "NextDeveloper" "NextAdmin" "NextLibrary" "Net" "odmach" "sdmach" "me" "NextTour" "LocalApps" "Mailboxes" "LocalLibrary" "Users" "clients"]
Also see folders_in(path, type, include_dot), paths_in(path, type, include_dot) and plain_files_in(path, type, include_dot).
#end_method

#begin_method
filetype_for(file) 
Returns the extension of the the file with the complete filename file.
#end_method

#begin_method
folders_in(path, type, include_dot) 
Returns a collection of the names of the folders in the directory with the full pathname path. 
type specifies the file extension of the folders you want to collect. If you want to collect all folders type should be nil.
include_dot should be true if you want to include hidden folders (i.e. folders with a dot (.) in the beginning).
Ex:
the_program:folders_in("/", nil, true)
returns something like ["." ".." "lost+found" ".NeXT" "etc" "dev" "tmp" "usr" "bin" "private" "NextApps" "lib" "NextDeveloper" "NextAdmin" "NextLibrary" "Net" "me" "NextTour" "LocalApps" "Mailboxes" "LocalLibrary" ".createImages" "Users" ".NextTrash" "clients"]
the_program:folders_in("/", nil, false)
returns something like ["lost+found" "etc" "dev" "tmp" "usr" "bin" "private" "NextApps" "lib" "NextDeveloper" "NextAdmin" "NextLibrary" "Net" "me" "NextTour" "LocalApps" "Mailboxes" "LocalLibrary" "Users" "clients"]
Also see files_in(path, type, include_dot).
#end_method

#begin_method
folder_paths_in(path, type, include_dot) 
Returns a collection of the full pathnames of the folders in the directory with the full pathname path. 
type specifies the file extension of the folders you want to collect. If you want to collect all folders type should be nil.
include_dot should be true if you want to include hidden folders (i.e. folders with a dot (.) in the beginning).
Also see folders_in(path, type, include_dot). 
#end_method

#begin_method
hide 
Hides all windows that belongs to the program.
Returns self.
#end_method

#begin_method
hour(24_hour) 
Returns the current hour. If 24_hour is true hours are between 0 and 23. If 24_hour is false hours are between 0 and 11.
Ex:
Assume that the time is 16:45 (4:45 PM).
the_program:hour(true)
returns 16
the_program:hour(false)
returns 4
#end_method

#begin_method
icon 
Returns the icon property of the program.
#end_method

#begin_method
images 
Returns the images property of the program.
#end_method

#begin_method
is_program_launched(host, name) 
Returns true if the CraftMan program name is open on the machine host on the network. Otherwise the method returns false. If host is nil that means the local machine.
Ex:
the_program:is_program_launched(nil, "untitled_1")
returns true if the program untitled_1 is open on the local machine.
the_program:is_program_launched("next1", "untitled_1")
returns true if the program untitled_1 is open on the machine with the name next1.
#end_method

#begin_method
key_window 
Returns the key_window property of the program.
#end_method

#begin_method
launch_application(host, application) 
Launches application on the machine host on the network. If host is nil that means the local machine.
Returns true if successful. Otherwise the method returns false.
#end_method

#begin_method
main_menu 
Returns the main_menu property of the program.
#end_method

#begin_method
main_window 
Returns the main_window property of the program.
#end_method

#begin_method
minute 
Returns the minute of the current hour.
#end_method

#begin_method
month 
Returns the month of the current year.
#end_method

#begin_method
month_name(abbreviated) 
Returns the name of the current month. If abbreviated is true the name will be abbreviated.
Ex:
the_program:month_name(true)
returns "Feb"
the_program:month_name(false)
returns "February"
#end_method

#begin_method
notify(title, message) 
Opens a dialog box with a title, a message and an "Ok"-button.
Returns self. 
Ex:
the_program:notify("Alert!", "You may not delete this!")
#end_method

#begin_method
open_file(host, path) 
Opens the file with the complete pathname path on the machine host on the network. If host is nil that means the local machine. If path is not a valid pathname the method returns nil.
Ex:
the_program:open_file(nil, "/NextApps")
will open the folder /NextApps in the Workspace.
#end_method

#begin_method
open_the_color_panel 
Opens the Color panel.
Returns self.
#end_method

#begin_method
open_the_console 
Opens the Console window.
Returns self.
#end_method

#begin_method
open_the_font_panel 
Opens the Font panel.
Returns self.
#end_method

#begin_method
path 
Returns the complete filename for the current program.
Also see filename.
#end_method

#begin_method
paths_in(path, type, include_dot) 
Returns a collection of the complete names of the files in the directory with the full pathname path. 
type specifies the file extension of the files you want to collect. If you want to collect all files type should be nil.
include_dot should be true if you want to include hidden files (i.e. files with a dot (.) in the beginning).
Ex:
the_program:paths_in("/", nil, true)
returns something like ["/." "/.." "/lost+found" "/mach" "/.hidden" "/.login" "/.cshrc" "/.profile" "/.NeXT" "/etc" "/dev" "/tmp" "/usr" "/bin" "/private" "/NextApps" "/lib" "/NextDeveloper" "/NextAdmin" "/NextLibrary" "/Net" "/odmach" "/sdmach" "/me" "/NextTour" "/LocalApps" "/Mailboxes" "/LocalLibrary" "/.createImages" "/.wp.set" "/Users" "/.NextTrash" "/clients"]
Also see files_in(path, type, include_dot), folders_in(path, type, include_dot) and plain_files_in(path, type, include_dot).
#end_method

#begin_method
plain_files_in(path, type, include_dot) 
Returns a collection of the names without extension of the files in the directory with the full pathname path.
type specifies the file extension of the files you want to collect. If you want to collect all files type should be nil.
include_dot should be true if you want to include hidden files (i.e. files with a dot (.) in the beginning).
Also see files_in(path, type, include_dot) and paths_in(path, type, include_dot)
#end_method

#begin_method
plain_paths_in(path, type, include_dot) 
Returns a collection of the complete names without extension of the files in the directory with the full pathname path. 
type specifies the file extension of the files you want to collect. If you want to collect all files type should be nil.
include_dot should be true if you want to include hidden files (i.e. files with a dot (.) in the beginning).
Also see paths_in(path, type, include_dot), files_in(path, type, include_dot) and plain_files_in(path, type, include_dot).
#end_method

#begin_method
program_did_become_active 
This method does not do anything. The message is sent to the program when the program becomes the active program. Specialize the method to get the desired behavior. 
Returns self.
#end_method

#begin_method
program_did_enter_runmode 
This method does not do anything. The message is sent to the program when the program enters run-mode. Specialize the method to get the desired behavior. 
Returns self.
#end_method

#begin_method
program_did_hide 
This method does not do anything. The message is sent to the program when the program becomes hidden. Specialize the method to get the desired behavior. 
Returns self.
#end_method

#begin_method
program_did_resign_active 
This method does not do anything. The message is sent to the program when the program resigns from being the active program. Specialize the method to get the desired behavior. 
Returns self.
#end_method

#begin_method
program_did_unhide 
This method does not do anything. The message is sent to the program when the program unhides. Specialize the method to get the desired behavior. 
Returns self.
#end_method

#begin_method
program_was_unarchived 
This method does not do anything. The message is sent to the program when the program has been opened (i.e. loaded from disk). This message is only sent once. Specialize the method to get the desired behavior. 
Returns self.
#end_method

#begin_method
query(title, default_string, default_button_title, alternate_button_title) 
Opens a dialog box with a title, a textfield and two buttons. The return value depends on the button the user clicks. 
If the user clicks the default-button the method returns the string in the textfield.
If the user clicks the alternate-button the method returns false.
title is the title of the dialog box.
default_button_title is the text in the textfield.
Ex:
x := the_program:query("What is your name?", "Your name", "Ok", "Cancel")
if x <> false then
	s := "Hello "
	s := s + x + "!"
	print(s)
end if
#end_method

#begin_method
quit 
Closes the program.
#end_method

#begin_method
random_number(min, max) 
Returns a random integer which is greater than or equal to min and lesser than or equal to max.
Ex:
the_program:random_number(0, 100)
returns a number between 0 and 100
for x from 1 to 20 collect the_program:random_number(0, 20) end for
returns something like [16 13 10 16 15 18 12 20 11 12 17 11 14 11 7 17 8 20 12 5]
#end_method

#begin_method
random_percent 
Returns a random float which is greater than or equal to 0.0 and lesser than or equal to 1.0.
Ex:
the_program:random_percent
returns a float between 0.0 and 1.0
for x from 1 to 20 collect the_program:random_percent end for
returns something like [0.245408 0.758983 0.641522 0.414390 0.852697 0.373900 0.333082 0.812375 0.702549 0.244756 0.303219 0.639081 0.972493 0.334116 0.251965 0.260153 0.713004 0.705931 0.968459 0.044756]

#end_method

#begin_method
reply_timeout 
Returns the reply_timeout property of the program.
#end_method

#begin_method
second 
Returns the second of the current minute.
#end_method

#begin_method
send_alien_message(host, application, selector, types, args) 
Sends an Objective-C message to another NeXTstep application. You can send arguments or pointers to arguments to get return values.
host is the machine that runs the application. If host is nil it means the local machine.
application is the name of the NeXTstep application.
selector is the name of the Objective-C message you want to send.
types is a string that specifies the types of the arguments to the message.
args is a collection of the arguments to the message.
The different types are:
i - integer
d - double (float)
b - boolean
c - string
If the argument is a pointer to a value, use capital letters.
I - pointer to an integer
D - pointer to a double (float)
B - pointer to a boolean
C - pointer to a string
Returns self. If the message is not successfully sent the method will return a symbol that indicates the error.
Ex:
The NeXTstep application Edit understands the Objective-C message 
- openFile:(STR)file ok:(int *)flag;
To open the file /etc/hosts in Edit you can type the following:
the_program:send_alien_message(nil, "Edit", "openFile:ok:", "cI", ["/etc/hosts" #x])
Note: Since the second argument is a pointer to an integer the argument in the args collection should be a symbol (#x).
If the message was sent successfully the variable x will have the value 1.
#end_method

#begin_method
send_remote_message(host, program, wait_for_reply, message, arguments) 
Sends the CraftScript message to a CraftMan program that is open on the local machine.
host is the name of the machine that runs the program. If host is nil it means the local machine.
program is the name of the program.
If the message has arguments they should be passed as the collection arguments.
If the message has no arguments the value of arguments should be nil.
If you want the return values from the messages wait_for_reply should be true.
The method returns a collection of values, one for each program that received the message.
If wait_for_reply is false you will get one of the following values:
true - the execution of the method was successful.
false - the execution of the method failed.
#program_is_in_edit_mode - the program was in edit-mode.
#program_is_running - the program was running.
#message_not_understood - the program did not understand the message.
#wrong_number_of_arguments - the message was sent with the wrong number of arguments.
If wait_for_reply is true you will get the return value from the method or one the following values:
false - the execution of the method failed.
nil - the return value was of a class that does not exist in the current program.
#program_is_in_edit_mode - the program was in edit-mode.
#program_is_running - the program was running.
#message_not_understood - the program did not understand the message.
#wrong_number_of_arguments - the message was sent with the wrong number of arguments.
Ex:
Assume that you have two programs open. One is called my_program and it implements the method my_add(x, y). The method adds two numbers and returns the sum. If you from the other program send
the_program:send_remote_message(nil, "my_program", "my_add", [12 13], true)
it will return 25
#end_method

#begin_method
send_timeout 
Returns the send_timeout property of the program.
#end_method

#begin_method
send_to_unix(string) 
Executes string in a UNIX shell.
Ex:
the_program:send_to_unix("open /etc/hosts")
will open the file /etc/hosts.
#end_method

#begin_method
set_icon(image) 
Sets the icon property to image.
Returns self.
#end_method

#begin_method
set_main_menu(menu) 
Sets the main_menu property to menu.
Returns self.
#end_method

#begin_method
set_reply_timeout(number) 
Sets the reply_timeout property to number.
Returns self.
#end_method

#begin_method
set_send_timeout(number) 
Sets the send_timeout property to number.
Returns self.
#end_method

#begin_method
set_version(number) 
Sets the version property to number.
Returns self.
#end_method

#begin_method
sleep(milliseconds) 
Halts the execution of the script for the number of milliseconds specified by milliseconds.
Ex:
the_program:sleep(1000)
will halt the execution for one second.
#end_method

#begin_method
sounds 
Returns the sounds property of the program.
#end_method

#begin_method
stop 
Stops the execution of the program.
#end_method

#begin_method
time 
Returns the current time.
Ex:
the_program:time
returns something like "16:00:22 GMT+0100"
#end_method

#begin_method
timers 
Returns the timers property of the program.
#end_method

#begin_method
time_zone 
Returns the current time zone.
Ex:
the_program:time_zone
returns something like "GMT+0100"
#end_method

#begin_method
unarchive(file) 
Reads an object from a file with the complete filename file. 
Returns the new object. If file was not a valid filename or if you do not have read permission the method returns false.
Ex:
Create a new button:
b1 := {button}:new
Write it to a file:
the_program:archive("myobject", b1)
Read it from the file:
b2 := the_program:unarchive("myobject")
Also see archive(file, object).
#end_method

#begin_method
unhide 
Unhides the program.
Returns self.
#end_method

#begin_method
verify(title, message) 
Opens a dialog box with a title, a message and two buttons. The return value depends on the button the user clicks. 
If the user clicks the "Ok"-button the method returns true.
If the user clicks the "Cancel"-button the method returns false.
title is the title of the dialog box.
message is the message of the dialog box.
Ex:
x := the_program:verify("Note!", "Save edited files?")
if x = true then
	save files...
end if
#end_method

#begin_method
version 
Returns the version property of the program.
#end_method

#begin_method
weekday(abbreviated) 
Returns the name of the current weekday. If abbreviated is true the name will be abbreviated.
Ex:
the_program:weekday(true)
returns "Sun"
the_program:weekday(false)
returns "Sunday"
#end_method

#begin_method
week_of_year 
Returns the number of the current week in the current year.
#end_method

#begin_method
windows 
Returns the windows property of the program.
#end_method

#begin_method
year 
Returns the current year.
Ex:
the_program:year
returns 92
#end_method

Class Methods 

#begin_class_method
new 
You cannot create a program from a program.
Ex:
{program}:new
raises an exception
Exception:
It is an error to create a new program within a program !
#end_class_method